//
//  APLoginPrivacyPolicyView.m
//  AqualPolo
//
//  Created by dong on 2024/5/2.
//

#import "APLoginPrivacyPolicyView.h"

@interface APLoginPrivacyPolicyView ()

@end

@implementation APLoginPrivacyPolicyView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        UIImageView *backgroundImageView = [[UIImageView alloc] init];
        backgroundImageView.image = [UIImage imageNamed:@"login_alert_bg"];
        [self addSubview:backgroundImageView];
        [backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
        
        UIImageView *logoImageView = [[UIImageView alloc] init];
        logoImageView.image = [UIImage imageNamed:@"launch_icon"];
        [self addSubview:logoImageView];
        [logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).offset(32);
            make.centerX.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(64, 64));
        }];
        
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.textColor = [UIColor whiteColor];
        titleLabel.font = [LYFont fontWithSize:14 fontName:LYFontNamepfb];
        titleLabel.textAlignment = NSTextAlignmentCenter;
        titleLabel.text = @"AquaPolo";
        [self addSubview:titleLabel];
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(logoImageView.mas_bottom).offset(8);
            make.left.right.equalTo(self);
        }];
        
        _protocolControl = [[APProtocolControl alloc] initWithColor:UIColor.whiteColor highlightColor:LYRGBColor(87, 61, 255)];
        _protocolControl.isCheckIconVisible = false;
        [self addSubview:_protocolControl];
        [_protocolControl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(titleLabel.mas_bottom).offset(12);
            make.left.equalTo(self).offset(24);
            make.right.equalTo(self).offset(-24);
            make.height.mas_equalTo(40);
        }];
        
        _agreeButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_agreeButton setTitle:@"Agree and Continue" forState:UIControlStateNormal];
        _agreeButton.titleLabel.font = [LYFont fontWithSize:14 fontName:LYFontNamepfb];
        _agreeButton.layer.cornerRadius = 20;
        _agreeButton.layer.masksToBounds = true;
        _agreeButton.backgroundColor = LYRGBColor(87, 61, 255);
        [self addSubview:_agreeButton];
        [_agreeButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_protocolControl.mas_bottom).offset(36);
            make.centerX.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(180, 40));
        }];
        
        _cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_cancelButton setTitle:@"Cancel" forState:UIControlStateNormal];
        _cancelButton.titleLabel.font = [LYFont fontWithSize:14 fontName:LYFontNamepfb];
        _cancelButton.layer.cornerRadius = 20;
        _cancelButton.layer.masksToBounds = true;
        _cancelButton.backgroundColor = LYRGBColor(25, 43, 60);
        [self addSubview:_cancelButton];
        [_cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_agreeButton.mas_bottom).offset(20);
            make.centerX.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(180, 40));
            make.bottom.equalTo(self).offset(-24);
        }];
    }
    return self;
}

@end
